{% extends "base.html" %}
{% block title %}Formularios{% endblock %}
{% block mainframe %}

			{% if instances %}
				<h1>Instancias</h1>
				<h2>Instancias del formulario: {{ instances.0.form.id }}</h2>
				<table id="instancestable">
				<thead>
					<td><span class="tableelement">Nombre del formulario</span></td>
					<td><span class="tableelement">Version</span></td>
					<td><span class="tableelement">Id de la instancia</span></td>
					<td><span class="tableelement">Acciones</span></td
				</thead>
				<tbody>
				{% for instance in instances %}
					<tr>
						<td>
							<span class="tableelement">{{ instance.form.name }}</span>
						</td>
						<td>
							<span class="tableelement">{{ instance.form.version }}</span>
						</td>
						<td>
							<a href="/beekeeper/show_instance/{{ instance.id }}"><span class="tableelement">{{ instance.id }}</span></a>
						</td>
						<td>
						    <form name="elementDelete" action="/beekeeper/show_instance_list/{{ instance.form.id }}/" method="post">
						        {% csrf_token %}
						        <input type="hidden" name="elementToDelete" value="{{ instance.id }}" />
						        <input type="image" src="/beekeeper/images/buttons/delete.png" name="submit" />
								<!--<a href="document.elementDelete.submit();"><span class="tableelement"><img class="delete" src="/beekeeper/images/buttons/delete.png" /></span></a>-->
						    </form>
							<!-- <a href="/beekeeper/delete_instance/{{ instance.id }}"><span class="tableelement"><img class="delete" src="/beekeeper/images/buttons/delete.png" /></span></a> -->
							<a href="/beekeeper/show_instance_map/{{ instance.id }}"><span class="tableelement">Geolocalizar</span></a>
						</td>
					</tr>
				{% endfor %}
				</tbody>
					<tfoot></tfoot>
				</table>
				<br/>
			{% else %}
				<br />
				<h3>No se ha encontrado ninguna instancia del formulario en la base de datos.</h3>
			{% endif %}

{% endblock %}


{% block sidebar %}
		    <ul>
				<li><a class="item" href="/beekeeper/show_form_list/" id="campo0">
					<img src="/beekeeper/images/tw_back.png" />
					<div class="label">
						<p><strong>Volver atr&aacute;s</strong></p>
					</div>
				</a></li>
			</ul>
{% endblock %}


{% block result %}
	{% if deleting %}
      <p class="enlaceeliminar">¿Desea eliminar la instancia? <br /><a href="/beekeeper/delete_instance/{{ instanceToDelete }}">Sí, eliminar la instancia.</a></p>
    {% endif %}
{% endblock %}


{% block extrajs %}
	{% if deleting %}
		<script language="JavaScript">
			$("#resultado").toggle('slow');
	    </script>
    {% endif %}
{% endblock %}